 <meta charset="utf-8">
 <div class="card card-primary" id="app_deviceModel_edit" style="max-width: 1200px;" > 
 
     <form role="form"  id="editForm" >
            <div class="card-body"> 
			    
			    <div class="form-group" >
                  <label for="name" class="control-label">型号名称</label>
                  <input type="text" v-model="deviceModel.name" class="form-control"  required="required"/>
                </div>
                
                <div class="form-group" >
                  <label for="unit" class="control-label">所属系列</label>
                   <select v-model="deviceModel.typeId"  class="form-control" style="min-width: 150px;"   >
					    <option  value="">请选择</option>
						<option v-bind:value="deviceType.id" v-for="deviceType in deviceTypelList" >{{deviceType.name}}</option>
					</select>
                </div>
                
             
                 <div class="form-group">
                  <label for="permCode" class="control-label">备注</label>
                  <input type="text" v-model="deviceModel.remark" class="form-control"/>
                </div>
             
            </div>
            <div class="form-group" style="padding-right: 15px;padding-left: 15px;">
                 <button type="button" class="btn btn-light" v-on:click="cancel">取消</button>
                 <button type="button" class="btn btn-info float-right"  v-on:click="edit">提交</button>
              </div> 
       </form>

<script type="text/javascript">
var news= new Vue({
    el: '#app_deviceModel_edit',
    data: {
    	deviceModel:{
    		id:null,
    		name:null,
    		typeId: null,
    		remark: null,
    	},
    	deviceTypelList:[],
    	bus:new Vue()
     },
     mounted:function(){
    	 var _this=this;
    	 _this.loadAllDeviceType();
     },
     methods: {
    	 loadAllDeviceType: function(){
    		 var　_this=this;
    		var ajaxUrl="/manger/deviceType/loadAllDeviceType";
    		zfesAjax.ajaxTodo(ajaxUrl,{}, function(data) {
				_this.deviceTypelList=data.data.result;
			}); 
    	},
    	
    	 edit: function () {
    	    	if($("#editForm").valid()){
    	    		var _this=this;
    	    		var url="/manger/deviceModel/createDeviceModel";
    	    		zfesAjax.ajaxTodo(url,_this.deviceModel, function(data){
    	    			alertSwal.successText(data.message);
    	        		 layer.close(layer.index);
    	        	 })
    	    		
    	    	}
    	    },
    	    cancel: function(){
    	    	console.log(layer.index);
    	    	 layer.close(layer.index);
    	    }
    }
});
</script>
</div>